<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>银行卡管理</title>
	<meta name="decorator" content="default"/>
	<%-- <script type="text/javascript" src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script><!-- jQuery is required -->
	<script type="text/javascript" src="${ctxStatic}/custom/js/validate.js"></script> --%>
	<script type="text/javascript">
		$(document).ready(function() {
            
			$("#cardName").focus();
			
			$("#inputForm").validate({
				submitHandler: function(form){
                   
                    loading('正在提交，请稍等...');
                    form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
			var type = '${bankCard.type}';
			if(type != null && type == '2'){
				$("#creditBody").css("display", "block");
			} else {
				$("#creditBody").css("display", "none");
			}
			
		});
		
		function typeChange(){
			
			$(".typeSelect").each(function(){
				if($(this).is(":checked")){
					var type = $(this).val();
					
					if(type == '2'){ // 信用卡
						$("#creditBody").css("display", "block");
					} else {
						$("#creditBody").css("display", "none");
					}
				}
			});
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/pay/bankcard/">银行卡列表</a></li>
		<li class="active"><a href="<c:url value='${fns:getAdminPath()}/pay/bankcard/form?id=${bankcard.id}'></c:url>">银行卡${not empty bankcard.id?'修改':'添加'}</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="bankCard" action="${ctx}/pay/bankcard/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<div class="control-group">
			<label class="control-label">登录名:</label>
			<div class="controls">
				<form:input path="creator.loginName" htmlEscape="false" maxlength="200" readonly="true" class="input-large"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">持卡人姓名:</label>
			<div class="controls">
				<form:input path="cardName" htmlEscape="false" maxlength="200" class="input-large required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">证件类型:</label>
			<div class="controls">
				<form:select path="certiType" class="input-medium required">
					<form:option value="" label="请选择" selected="selected"/>
					<form:options items="${fns:getDictList('pay_certi_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">证件号:</label>
			<div class="controls">
				<form:input path="idCard" htmlEscape="false" maxlength="200" class="input-xlarge measure-input required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">银行卡开户行:</label>
			<div class="controls">
				<form:input path="bankName" htmlEscape="false" maxlength="200" class="input-xlarge required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">银行卡账号:</label>
			<div class="controls">
				<form:input path="bankCardNum" htmlEscape="false" maxlength="200" class="input-xlarge measure-input required"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">卡类型:</label>
			<div class="controls">
				<form:radiobuttons path="type" items="${fns:getDictList('pay_bank_card_type')}" itemLabel="label" itemValue="value" onchange="typeChange();" htmlEscape="false" class="typeSelect required"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div id="creditBody" style="display:none;">
			<div class="control-group">
				<label class="control-label">有效期限:</label>
				<div class="controls">
					<form:input path="bankCardCredit.validThru" htmlEscape="false" maxlength="200" class="input-medium"/>
					<span class="help-inline">(格式：MMYY，如04/16，请填写 '0416')</span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">账单日:</label>
				<div class="controls">
					<span class="help-inline">每月&nbsp;</span>
					<input id="bankCardCredit.billDate" name="bankCardCredit.billDate" type="text" readonly="readonly" maxlength="20" class="input-small Wdate"
					value="${bankCard.bankCardCredit.billDate}"
					onclick="WdatePicker({dateFmt:'dd',isShowClear:false});"/>
					<span class="help-inline">&nbsp;日</span>
				</div>
			</div>
			<%-- <div class="control-group">
				<label class="control-label">到期还款日:</label>
				<div class="controls">
					<form:input path="bankCardCredit.repaymentDate" htmlEscape="false" maxlength="200" class="input-xlarge"/>
					<span class="help-inline"></span>
				</div>
			</div> --%>
			<div class="control-group">
				<label class="control-label">信用额度:</label>
				<div class="controls">
					<form:input path="bankCardCredit.creditLimit" htmlEscape="false" maxlength="200" class="input-medium"/>
					<span class="help-inline">(单位：元)</span>
				</div>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">认证状态:</label>
			<div class="controls">
				<form:radiobuttons path="status" items="${fns:getDictList('pay_auth_status')}" itemLabel="label" itemValue="value" onchange="statusChange();" htmlEscape="false" class="auditSelect required"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div id="remarkBody" class="control-group" style="display:none;">
			<label class="control-label">备注:</label>
			<div class="controls">
				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="200" class="input-xxlarge"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发布时间:</label>
			<div class="controls">
				<input id="createDate" name="createDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${bankCard.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">发布状态:</label>
			<div class="controls">
				<form:radiobuttons path="delFlag" items="${fns:getDictList('cms_del_flag')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
				<span class="help-inline"></span>
			</div>
		</div>
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>